<%@ include file="/common/taglibs.jsp" %>

<head>
    <title><fmt:message key="creditUnionDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='creditUnionDetail.heading'/>"/>
</head>

<spring:bind path="creditUnion.*">
    <c:if test="${not empty status.errorMessages}">
        <div class="error">
            <c:forEach var="error" items="${status.errorMessages}">
                <img src="<c:url value="/images/iconWarning.gif"/>"
                     alt="<fmt:message key="icon.warning"/>" class="icon"/>
                <c:out value="${error}" escapeXml="false"/><br/>
            </c:forEach>
        </div>
    </c:if>
</spring:bind>

<form:form commandName="creditUnion" method="post" action="creditunionform" id="creditUnionForm">
    <form:errors path="*" cssClass="error" element="div"/>
    <form:hidden path="id"/>
    <ul>
        <li class="info">
            <c:choose>
                <c:when test="${param.from == 'list'}">
                    <p><fmt:message key="creditunion.admin.message"/></p>
                </c:when>
                <c:otherwise>
                    <p><fmt:message key="creditunion.message"/></p>
                </c:otherwise>
            </c:choose>
        </li>
        <li>
            <appfuse:label styleClass="desc" key="creditunion.name"/>
            <form:errors path="name" cssClass="fieldError"/>
            <form:input path="name" id="name" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
        </li>
        <li>
            <label class="desc"><fmt:message key="creditunion.address"/></label>

            <div class="group">
                <div>
                    <form:input path="address" id="address" cssClass="text large"
                                cssErrorClass="text large error"/>
                    <form:errors path="address" cssClass="fieldError"/>
                    <p><appfuse:label key="creditunion.address"/></p>
                </div>
                <div class="left">
                    <form:input path="city" id="city" cssClass="text medium"
                                cssErrorClass="text medium error"/>
                    <form:errors path="city" cssClass="fieldError"/>
                    <p><appfuse:label key="creditunion.city"/></p>
                </div>
                <div>
                    <form:input path="state" id="state" cssClass="text state"
                                cssErrorClass="text state error"/>
                    <form:errors path="state" cssClass="fieldError"/>
                    <p><appfuse:label key="creditunion.state"/></p>
                </div>
                <div class="left">
                    <form:input path="postalCode" id="postalCode" cssClass="text medium"
                                cssErrorClass="text medium error"/>
                    <form:errors path="postalCode" cssClass="fieldError"/>
                    <p><appfuse:label key="creditunion.postalCode"/></p>
                </div>
                <div>
                    <p><br/></p>
                    <p><br/></p>
                </div>
            </div>
        </li>
        <li class="buttonBar bottom">
            <input type="submit" class="button ui-button" name="save" value="<fmt:message key="button.save"/>"/>
            <c:if test="${not empty creditUnion.id}">
                <input type="submit" class="button" name="delete" onclick="bCancel=true;return confirmDelete('creditUnion')"
                       value="<fmt:message key="button.delete"/>"/>
            </c:if>
            <input type="submit" class="button" name="cancel" value="<fmt:message key="button.cancel"/>"
                   onclick="bCancel=true"/>
        </li>
    </ul>
</form:form>

<script type="text/javascript">
    Form.focusFirstElement($('creditUnionForm'));
</script>